
<script data-obct type = "text/javascript">

  /** DO NOT MODIFY THIS CODE**/

  !function(_window, _document) {

    var OB_ADV_ID = {{outbrain_pixels| json}}; // '00aecec8f0bbd0eba20329d8409ac8fdb9';

    if (_window.obApi) {

      var toArray = function(object) {

        return Object.prototype.toString.call(object) === '[object Array]' ? object : [object];

      };

      _window.obApi.marketerId = toArray(_window.obApi.marketerId).concat(toArray(OB_ADV_ID));

      return;

    }

    var api = _window.obApi = function() {

      api.dispatch ? api.dispatch.apply(api, arguments) : api.queue.push(arguments);

    };

    api.version = '1.1';

    api.loaded = true;

    api.marketerId = OB_ADV_ID;

    api.queue = [];

    var tag = _document.createElement('script');

    tag.async = true;

    tag.src = '//amplify.outbrain.com/cp/obtp.js';

    tag.type = 'text/javascript';

    var script = _document.getElementsByTagName('script')[0];

    script.parentNode.insertBefore(tag, script);

  }(window, document);


  obApi('track', 'PAGE_VIEW');
  {%- if template == 'product_detail' -%}
    obApi('track', 'Content View');
  {%- endif -%}

  {%- if template == 'search_detail' -%}
    obApi('track', 'Search');
  {%- endif -%}


  {%- if controller == 'order' and action == 'success' -%}
    {% capture outbrain_pixels_order_id %}outbrain_pixels_{{order.id}}{% endcapture %}
    {% get_cache key={outbrain_pixels_order_id} var_name=outbrain_pixels_status%}
    {% if outbrain_pixels_status ==0 %}
      obApi('track', 'Purchase',{
        {% if storeConfig.enable_ga %}
          orderValue: "{{ order.current_subtotal_price| plus: order.current_coupon_price| plus: order.current_promotion_price }}",
        {% else %}
          orderValue: "{{ order.total_price }}",
        {% endif %}
        currency: '{{order.currency_code}}',
        orderId: '{{order.order_number}}'
      });
    {% endif %}
  {%- endif -%}

  function callback_outbrain_add_to_cart(ecdata) {
    obApi('track', 'Add to Cart');
  };
  function callback_outbrain_generate_lead(ecdata) {};
  function callback_outbrain_login(ecdata) {};
  function callback_outbrain_begin_checkout(ecdata) {
    obApi('track', 'Checkout');
  };
  function callback_outbrain_share_product(ecdata) {};
  function callback_outbrain_remove_from_cart(ecdata) {};
  function callback_outbrain_sign_up(ecdata) {};
  function callback_outbrain_add_address_information(ecdata) {};
  function callback_outbrain_add_shipping_information(ecdata) {};
  function callback_outbrain_add_payment_information(ecdata) {};
  function callback_outbrain_to_wishlist(ecdata) {};
</script>